package cn.hr.test_actions;

import java.util.Map;

import cn.hr.test_beans.User;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class TestAction extends ActionSupport {
	
	private String name;
	private String password;
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	
	@SuppressWarnings("unchecked")
	@Override
	public String execute() throws Exception {
		if(name==null){
			return INPUT;
		}else if(password==null){
			return INPUT;
		}else{
			User user1 = new User();
			user1.setName(name);
			user1.setPassword(password);
			Map map = (Map)ActionContext.getContext().get("request");
			map.put("user1", user1);
			System.out.println("name:"+name+"\npassword:"+password);
			return SUCCESS;
		}
	}
}
